

// Correlate different measures of duration + stat desc on these  

use  base_4decile$firstyear$lastyear, clear
drop if export==0
collapse (mean) length_bp length_bps count_transactions_bp count_sellers_bp count_continuous_bp count_recall_bp proba_switch_bp proba_switch_unconditional_bp frequency_bp proba_recal (sum) totx, by(iso2 id_bp)
g oneoverproba_switch_bp=1/proba_switch_bp
g oneoverproba_switch_unc=1/proba_switch_unconditional_bp
pwcorr length_bps oneoverproba_switch_bp oneoverproba_switch_unc

tabstat length_bps oneoverproba_switch_bp oneoverproba_switch_unc frequency_bp proba_recall_bp , s(mean p50 p25 p75) save
return list
matrix A = r(StatTotal)
putexcel set $outputpath/table_online_2.xlsx, replace
putexcel A1 = matrix(A), names



